﻿@using Metro.Kashikoi.Web.HtmlHelpers
@using Metro.Kashikoi.ServiceContract.Item
@model Metro.Kashikoi.ServiceContract.Item.StockItem
@{
    ViewBag.Title = "Edit";
    ViewBag.MenuId = "itemMasterLink";

    IEnumerable<Category> categoryList = ViewBag.CategoryList;
}
<h2>
    Edit</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ErrorMessage((string)ViewBag.Message)
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Stock Item</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.GenericName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GenericName)
            @Html.ValidationMessageFor(model => model.GenericName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.BrandName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.BrandName)
            @Html.ValidationMessageFor(model => model.BrandName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.AlternatName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AlternatName)
            @Html.ValidationMessageFor(model => model.AlternatName)
        </div>
        <div class="editor-label">
            Select a category
        </div>
        <div class="editor-field">
            @Html.DropDownList("categoryList", categoryList.Select(item => new SelectListItem { Text = item.Name, Value = item.Id.ToString() }))
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.VendorCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.VendorCode)
            @Html.ValidationMessageFor(model => model.VendorCode)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.UnitCost)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitCost)
            @Html.ValidationMessageFor(model => model.UnitCost)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ChargeCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ChargeCode)
            @Html.ValidationMessageFor(model => model.ChargeCode)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ChargeAmount)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ChargeAmount)
            @Html.ValidationMessageFor(model => model.ChargeAmount)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PackSize)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PackSize)
            @Html.ValidationMessageFor(model => model.PackSize)
        </div>
        @Html.HiddenFor(model => model.Id)
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
